class CategoriesController < ApplicationController
	def deleteCategory
		 Category.find(params[:id]).destroy
		 redirect_to :action => 'categoryDeleted'

	end
	def categoryDeleted
	end
	def editCategories
		 @category = Category.find(params[:id])
	end
	
	def update
		@category = Category.find(params[:id])
		if @category.update_attributes(params[:category])
      @category.save
      redirect_to :action => :index, :id => @category
   else render :action => :editCategories
  end
end
def newTopic
	@category = Category.find(params[:id])
end

def UpdateFailed
  end
	def index
		@categories = Category.find(:all)
	end
	def details
		@category = Category.find(params[:id])
		@topics = @category.topics
		if @topics.length == 0
 				redirect_to :action => :noTopicsInCategory
	end
	end
	def backToIndex
		redirect_to :action => :index
	end
def new
	@newCat = params[:category]
	Category.new(@newCat).save
	redirect_to :action => :index
end
end
